﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.UI;
using System.Web.UI.WebControls;
using IMark.DAO;
namespace IMark.Admin.Ajax
{
    public partial class ImageProduct : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        [WebMethod]
        public static string DeleteImageProduct(long ID, long IDSanPham)
        {
            try
            {                
                if (HinhSanPhamModels.GetQuatityImage(IDSanPham) > 1)
                {
                    HinhSanPhamModels.Delete(ID, "~/images/products/");
                    return "0";
                }
                else
                {
                    return "-1";
                }
            }
            catch (Exception)
            {
                return null;                
            }
        }
    }
}